package cn.gemiman.daoyi.module.iot.dal.mysql.equipmentmsg;

import java.util.*;

import cn.gemiman.daoyi.framework.common.pojo.PageResult;
import cn.gemiman.daoyi.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.gemiman.daoyi.framework.mybatis.core.mapper.BaseMapperX;
import cn.gemiman.daoyi.module.iot.dal.dataobject.equipmentmsg.EquipmentMsgDO;
import org.apache.ibatis.annotations.Mapper;
import cn.gemiman.daoyi.module.iot.controller.admin.equipmentmsg.vo.*;

/**
 * 设备消息 Mapper
 *
 * @author 道一源码
 */
@Mapper
public interface EquipmentMsgMapper extends BaseMapperX<EquipmentMsgDO> {

    default PageResult<EquipmentMsgDO> selectPage(EquipmentMsgPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<EquipmentMsgDO>()
                .eqIfPresent(EquipmentMsgDO::getEquipmentId, reqVO.getEquipmentId())
                .likeIfPresent(EquipmentMsgDO::getEquipmentName, reqVO.getEquipmentName())
                .likeIfPresent(EquipmentMsgDO::getMsgName, reqVO.getMsgName())
                .likeRightIfPresent(EquipmentMsgDO::getMsgKey, reqVO.getMsgKey())
                .eqIfPresent(EquipmentMsgDO::getMsgValue, reqVO.getMsgValue())
                .eqIfPresent(EquipmentMsgDO::getAlarmStatus, reqVO.getAlarmStatus())
                .betweenIfPresent(EquipmentMsgDO::getMsgTime, reqVO.getMsgTime())
                .betweenIfPresent(EquipmentMsgDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(EquipmentMsgDO::getId));
    }

}
